<?php
include 'kahlua.ini';
include 'classes/utils/smarty_connect.php';
include_once 'classes/handlers/notasHandler.php';
include_once 'classes/handlers/videosHandler.php';
include_once 'classes/handlers/albumsHandler.php';
include_once 'classes/handlers/ayNoMemesHandler.php';
include_once 'classes/handlers/encuestasHandler.php';
include_once 'classes/handlers/asilotwiteoHandler.php';
include_once 'classes/handlers/masimagenHandler.php';

$notasH = new NotasHandler();
$videosH = new videosHandler();
$albumsH = new albumsHandler();
$aynomemesH = new AyNoMemesHandler();
$encuestasH = new encuestasHandler();
$asilotwiteoH = new asilotwiteoHandler();
$masimagenH = new MasImagenHandler();

//right & left sidebars, footer & header
$colRodrigo = $notasH::getColRodrigo();
$topVideo = $videosH::getTopVideo();
$masTiempo = $notasH::getMasTiempo();
$masVistas = $notasH::getMasVistas();
$masComentadas = $notasH::getMasComentadas();
$enResumen = $notasH::getEnResumenFP();
$queFreson = $albumsH::getTop3Albums('queFreson');
$ayNoMemes = $aynomemesH::getTopMeme();
$esquinaNaranja = $notasH::getEsquinaNaranja();
$fresonPolitico = $albumsH::getTop3Albums('fresonPolitico');
$encuesta = $encuestasH::getEncuesta();
$queGuau = $albumsH::getTop3Albums('queGuau');
$gadgets = $notasH::getGadgets();
$asilotwiteo = $asilotwiteoH->getTop();
$masImagen = $masimagenH::getTopMasImagen();

$videos20 = $videosH::getLast20();

if (isset($_GET["vid"])) {
	$mainVideo = $videosH::getMainVideo($_GET["vid"]);
} else {
    $mainVideo = "";
}

//echo "<pre>"; print_r($mainVideo); var_dump($_GET); exit();

$smarty = new smarty_connect;
$smarty->template_dir = '/projects/masmedio2013/templates';

$smarty->assign('colRodrigo', $colRodrigo[0]);
$smarty->assign('topVideo', $topVideo[0]);
$smarty->assign('masTiempo', $masTiempo[0]);
$smarty->assign('masVistas', $masVistas);
$smarty->assign('masComentadas', $masComentadas);
$smarty->assign('enResumen', $enResumen);
$smarty->assign('queFreson', $queFreson);
$smarty->assign('ayNoMemes', $ayNoMemes[0]);
$smarty->assign('esquinaNaranja', $esquinaNaranja);
$smarty->assign('fresonPolitico', $fresonPolitico);
$smarty->assign('encuesta', $encuesta[0]);
$smarty->assign('queGuau', $queGuau);
$smarty->assign('gadgets', $gadgets);
$smarty->assign('asilotwiteo', $asilotwiteo[0]);
$smarty->assign('masImagen', $masImagen);

$smarty->assign('videos20', $videos20);
$smarty->assign('mainVideo', $mainVideo);

$smarty->display('/projects/masmedio2013/templates/videos.tpl');